package tests.user;

/**
 * Copyright 2007, 2008 Viera K. Proulx
 * This program is distributed under the terms of the 
 * GNU Lesser General Public License (LGPL)
 */

/**
 * A sample abstract subclass to verify that tests include the common
 * field defined in the abstract class, as well as concrete methods
 * defined in the abstract class.
 *  
 * @author Viera K. Proulx
 * @since 29 October 2007
 */
public  class ALibItemMusic extends ALibItemCD{
  public String artist;
  
  /**
   * A constructor that initializes all fields - 
   * including the one from the superclass
   * 
   * @param title the title of this CD collection
   * @param catNo the catalog number for this CD collection
   * @param noDisks the number of CDs in this CD collection
   * @param artist the artist of this CD collection
   */
  public ALibItemMusic(String title, int catNo, int noDisks, String artist){
    this.title = title;
    this.catNo = catNo;
    this.noDisks = noDisks;
    this.artist = artist;
  }
  
  /**
   * Compare the length of the title against the author
   * --- example of an abstract method implemented in the concrete subclass
   * 
   * @return true if the title has the same length as the author
   */
  public boolean sameLength(){
    return title.length() == artist.length();
  }
  
  /**
   * Is this a book by the given auartistthor
   * --- an example of a method not defined or declared in the superclass
   * 
   * @return true if the artist of this music CD is the same as the given one
   */
  public boolean sameArtist(String artist){
    return this.artist.equals(artist);
  }
  
  /**
   * Override the toString method to test the printing feature
   * @return a String representation of this book
   */
  public String toString(){
  	return super.toString();
  }
}